package com.remenote.remenoteback.entity.vo;

import com.remenote.remenoteback.entity.doo.CardDo;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @BelongsProject: remenote-back
 * @BelongsPackage: com.remenote.remenoteback.entity.vo
 * @Author: 23392
 * @CreateTime: 2024-03-16  17:29
 * @Description: TODO
 * @Version: 1.0
 */
@Getter
@Setter
@Accessors(chain = true)
public class CardVo {
    public Integer id;
    public String deckName;
    public String deckId;
    public String front;
    public String back;
    public Integer memoryCount;

    public static CardVo fromCardDo(CardDo cardDo) {
        return new CardVo().setId(cardDo.getId())
                          .setDeckName(cardDo.getDeckName())
                          .setFront(cardDo.getFront())
                          .setBack(cardDo.getBack())
                .setId(cardDo.getId())
                          .setMemoryCount(cardDo.getMemoryCount());
    }
    public static List<CardVo> fromCardDos(List<CardDo> cardDos) {
        return cardDos.stream().map(CardVo::fromCardDo).toList();
    }

}
